import React from 'react'
import { NavBar } from 'antd-mobile'
import { ProductCard, Tag, Button } from 'react-vant';
import { SubmitBar } from 'react-vant';
import { Toast } from 'antd-mobile'
import http from './api/http'


const App = () => {


  const zf = async () => {
    const title = "火车票";
    const id = 5;
    const price = "666"
    const res = await http.get("/api/pay", { params:{ title, id, price } })
    const { code, data, message } = res.data
    if (code === 200) {
      window.location.href = data
    }else{
      Toast.show(message)
    }
  }

  return (
    <div>
      <NavBar>详情</NavBar>
      <ProductCard
        num="2"
        price="2.00"
        desc="描述信息"
        title="商品名称"
        thumb="https://img.yzcdn.cn/vant/ipad.jpeg"
      />
      <div className="demo-submit-bar"><SubmitBar price="3050" buttonText="提交订单" onSubmit={() => zf()} /></div>
    </div>
  )
}

export default App
